#include "Socket.hpp"
#include "Protocol.hpp"
// 
int main(int argc, char* argv[])
{
    if(argc != 3)
    {
        std::cout << "Usage: " << argv[0] << "ip " <<"port"<< std::endl;
    }
    std::string serverip = argv[1];
    uint16_t serverport = std::stoi(argv[2]);
    NetWork::Socket* s = new NetWork::TcpSocket();
    s->BuildConnectSocket(serverip,serverport);
    std::shared_ptr<ns_protocol::Factor> fac = std::make_shared<ns_protocol::Factor>();
    std::shared_ptr<ns_protocol::Request> Res = fac->BuildResquest(10,20,'+');
    while(true)
    {
        Res->Inc();
        send(s->GetSockFd(),&(*Res),sizeof(*Res),0);
        sleep(1);
    }
    s->CloseSockFd();
    return 0;
}